<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>PassNode - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
		<p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → <a href="TempNode.html">TempNode</a> → </p>
	<h1 translate="no">PassNode</h1>
		<section>
			<header>
				<div class="class-description"><p>Represents a render pass (sometimes called beauty pass) in context of post processing.
This pass produces a render for the given scene and camera and can provide multiple outputs
via MRT for further processing.</p></div>
				<h2>Code Example</h2>
				<div translate="no"><pre><code class="language-js">const postProcessing = new PostProcessing( renderer );
const scenePass = pass( scene, camera );
postProcessing.outputNode = scenePass;
</code></pre></div>
			</header>
			<article>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="PassNode" translate="no">new <a href="#PassNode">PassNode</a><span class="signature">( scope : <span class="param-type">'color' | 'depth'</span>, scene : <span class="param-type"><a href="Scene.html">Scene</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, options : <span class="param-type">Object</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Constructs a new pass node.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>scope</strong>
									</td>
									<td class="description last">
										<p>The scope of the pass. The scope determines whether the node outputs color or depth.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>scene</strong>
									</td>
									<td class="description last">
										<p>A reference to the scene.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>camera</strong>
									</td>
									<td class="description last">
										<p>A reference to the camera.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>options</strong>
									</td>
									<td class="description last">
										<p>Options for the internal render target.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
					<div class="description">
						<p>A reference to the camera.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="contextNode" translate="no">.<a href="#contextNode">contextNode</a><span class="type-signature"> : <a href="ContextNode.html">ContextNode</a> | null</span> </h3>
					<div class="description">
						<p>An optional global context for the pass.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="global" translate="no">.<a href="#global">global</a><span class="type-signature"> : boolean</span> </h3>
					<div class="description">
						<p>This flag is used for global cache.</p>
						<p>Default is <code>true</code>.</p>
					</div>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#global">TempNode#global</a></dt>
						</dl>
				</div>
				<div class="member">
					<h3 class="name" id="isPassNode" translate="no">.<a href="#isPassNode">isPassNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
					<div class="description">
						<p>This flag can be used for type testing.</p>
						<p>Default is <code>true</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="opaque" translate="no">.<a href="#opaque">opaque</a><span class="type-signature"> : boolean</span> </h3>
					<div class="description">
						<p>Whether the pass is opaque.</p>
						<p>Default is <code>true</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="options" translate="no">.<a href="#options">options</a><span class="type-signature"> : Object</span> </h3>
					<div class="description">
						<p>Options for the internal render target.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="overrideMaterial" translate="no">.<a href="#overrideMaterial">overrideMaterial</a><span class="type-signature"> : <a href="Material.html">Material</a> | null</span> </h3>
					<div class="description">
						<p>An optional override material for the pass.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="renderTarget" translate="no">.<a href="#renderTarget">renderTarget</a><span class="type-signature"> : <a href="RenderTarget.html">RenderTarget</a></span> </h3>
					<div class="description">
						<p>The pass's render target.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="scene" translate="no">.<a href="#scene">scene</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
					<div class="description">
						<p>A reference to the scene.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="scope" translate="no">.<a href="#scope">scope</a><span class="type-signature"> : 'color' | 'depth'</span> </h3>
					<div class="description">
						<p>The scope of the pass. The scope determines whether the node outputs color or depth.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="transparent" translate="no">.<a href="#transparent">transparent</a><span class="type-signature"> : boolean</span> </h3>
					<div class="description">
						<p>Whether the pass is transparent.</p>
						<p>Default is <code>false</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
					<div class="description">
						<p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node renders the
scene once per frame in its <a href="PassNode.html#updateBefore">PassNode#updateBefore</a> method.</p>
						<p>Default is <code>'frame'</code>.</p>
					</div>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
						</dl>
				</div>
				<div class="member">
					<h3 class="name" id=".COLOR" translate="no">.<a href="#.COLOR">COLOR</a><span class="type-signature"> : 'color'</span> </h3>
				</div>
				<div class="member">
					<h3 class="name" id=".DEPTH" translate="no">.<a href="#.DEPTH">DEPTH</a><span class="type-signature"> : 'depth'</span> </h3>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="compileAsync" translate="no">.<a href="#compileAsync">compileAsync</a><span class="signature">( renderer : <span class="param-type"><a href="Renderer.html">Renderer</a></span> )</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
					<div class="method">
						<div class="description">
							<p>Precompiles the pass.</p>
<p>Note that this method must be called after the pass configuration is complete.
So calls like <code>setMRT()</code> and <code>getTextureNode()</code> must proceed the precompilation.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>renderer</strong>
									</td>
									<td class="description last">
										<p>The renderer.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-see">See:</dt>
							<dd class="tag-see">
								<ul>
									<li><a href="Renderer.html#compileAsync">Renderer#compileAsync</a></li>
								</ul>
							</dd>
						</dl>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the compile has been finished.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
					<div class="method">
						<div class="description">
							<p>Frees internal resources. Should be called when the node is no longer in use.</p>
						</div>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getLayers" translate="no">.<a href="#getLayers">getLayers</a><span class="signature">()</span><span class="type-signature"> : <a href="Layers.html">Layers</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Gets the current layer configuration of the pass.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> .</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getLinearDepthNode" translate="no">.<a href="#getLinearDepthNode">getLinearDepthNode</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns a linear depth node of this pass.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The output name to get the linear depth node for. In most cases the default <code>'depth'</code> can be used however the parameter exists for custom depth outputs.</p>
										<p>Default is <code>'depth'</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The linear depth node.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getMRT" translate="no">.<a href="#getMRT">getMRT</a><span class="signature">()</span><span class="type-signature"> : <a href="MRTNode.html">MRTNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the current MRT node.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The current MRT node.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getPreviousTexture" translate="no">.<a href="#getPreviousTexture">getPreviousTexture</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the texture holding the data of the previous frame for the given output name.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The output name to get the texture for.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The texture holding the data of the previous frame.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getPreviousTextureNode" translate="no">.<a href="#getPreviousTextureNode">getPreviousTextureNode</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the previous texture node for the given output name.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The output name to get the previous texture node for.</p>
										<p>Default is <code>'output'</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The previous texture node.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getResolution" translate="no">.<a href="#getResolution">getResolution</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
					<div class="method">
						<div class="description">
							<p>Gets the current resolution of the pass.</p>
						</div>
						<dl class="details">
							<dt class="important tag-deprecated"><strong>Deprecated:</strong> since r181. Use <a href="PassNode.html#getResolutionScale">`getResolutionScale()`</a> instead.</dt>
						</dl>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The current resolution. A value of <code>1</code> means full resolution.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getResolutionScale" translate="no">.<a href="#getResolutionScale">getResolutionScale</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
					<div class="method">
						<div class="description">
							<p>Gets the current resolution scale of the pass.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The current resolution scale. A value of <code>1</code> means full resolution.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getTexture" translate="no">.<a href="#getTexture">getTexture</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the texture for the given output name.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The output name to get the texture for.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The texture.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getTextureNode" translate="no">.<a href="#getTextureNode">getTextureNode</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the texture node for the given output name.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The output name to get the texture node for.</p>
										<p>Default is <code>'output'</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The texture node.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getViewZNode" translate="no">.<a href="#getViewZNode">getViewZNode</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns a viewZ node of this pass.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The output name to get the viewZ node for. In most cases the default <code>'depth'</code> can be used however the parameter exists for custom depth outputs.</p>
										<p>Default is <code>'depth'</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The viewZ node.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setLayers" translate="no">.<a href="#setLayers">setLayers</a><span class="signature">( layers : <span class="param-type"><a href="Layers.html">Layers</a></span> )</span><span class="type-signature"> : <a href="PassNode.html">PassNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the layer configuration that should be used when rendering the pass.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>layers</strong>
									</td>
									<td class="description last">
										<p>The layers object to set.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this pass.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setMRT" translate="no">.<a href="#setMRT">setMRT</a><span class="signature">( mrt : <span class="param-type"><a href="MRTNode.html">MRTNode</a></span> )</span><span class="type-signature"> : <a href="PassNode.html">PassNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the given MRT node to setup MRT for this pass.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>mrt</strong>
									</td>
									<td class="description last">
										<p>The MRT object.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this pass.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setPixelRatio" translate="no">.<a href="#setPixelRatio">setPixelRatio</a><span class="signature">( pixelRatio : <span class="param-type">number</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the pixel ratio the pass's render target and updates the size.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>pixelRatio</strong>
									</td>
									<td class="description last">
										<p>The pixel ratio to set.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<h3 class="name name-method" id="setResolution" translate="no">.<a href="#setResolution">setResolution</a><span class="signature">( resolution : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="PassNode.html">PassNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the resolution for the pass.
The resolution is a factor that is multiplied with the renderer's width and height.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>resolution</strong>
									</td>
									<td class="description last">
										<p>The resolution to set. A value of <code>1</code> means full resolution.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="important tag-deprecated"><strong>Deprecated:</strong> since r181. Use <a href="PassNode.html#setResolutionScale">`setResolutionScale()`</a> instead.</dt>
						</dl>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this pass.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setResolutionScale" translate="no">.<a href="#setResolutionScale">setResolutionScale</a><span class="signature">( resolutionScale : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="PassNode.html">PassNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the resolution scale for the pass.
The resolution scale is a factor that is multiplied with the renderer's width and height.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>resolutionScale</strong>
									</td>
									<td class="description last">
										<p>The resolution scale to set. A value of <code>1</code> means full resolution.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this pass.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setScissor" translate="no">.<a href="#setScissor">setScissor</a><span class="signature">( x : <span class="param-type">number | <a href="Vector4.html">Vector4</a></span>, y : <span class="param-type">number</span>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>This method allows to define the pass's scissor rectangle. By default, the scissor rectangle is kept
in sync with the pass's dimensions. To reverse the process and use auto-sizing again, call the method
with <code>null</code> as the single argument.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>x</strong>
									</td>
									<td class="description last">
										<p>The horizontal coordinate for the lower left corner of the box in logical pixel unit.
Instead of passing four arguments, the method also works with a single four-dimensional vector.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>y</strong>
									</td>
									<td class="description last">
										<p>The vertical coordinate for the lower left corner of the box in logical pixel unit.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>width</strong>
									</td>
									<td class="description last">
										<p>The width of the scissor box in logical pixel unit.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>height</strong>
									</td>
									<td class="description last">
										<p>The height of the scissor box in logical pixel unit.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the size of the pass's render target. Honors the pixel ratio.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>width</strong>
									</td>
									<td class="description last">
										<p>The width to set.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>height</strong>
									</td>
									<td class="description last">
										<p>The height to set.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<h3 class="name name-method" id="setViewport" translate="no">.<a href="#setViewport">setViewport</a><span class="signature">( x : <span class="param-type">number | <a href="Vector4.html">Vector4</a></span>, y : <span class="param-type">number</span>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>This method allows to define the pass's viewport. By default, the viewport is kept in sync
with the pass's dimensions. To reverse the process and use auto-sizing again, call the method
with <code>null</code> as the single argument.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>x</strong>
									</td>
									<td class="description last">
										<p>The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>y</strong>
									</td>
									<td class="description last">
										<p>The vertical coordinate for the lower left corner of the viewport origin  in logical pixel unit.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>width</strong>
									</td>
									<td class="description last">
										<p>The width of the viewport in logical pixel unit.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>height</strong>
									</td>
									<td class="description last">
										<p>The height of the viewport in logical pixel unit.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<h3 class="name name-method" id="toggleTexture" translate="no">.<a href="#toggleTexture">toggleTexture</a><span class="signature">( name : <span class="param-type">string</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Switches current and previous textures for the given output name.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The output name.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/display/PassNode.js" translate="no" target="_blank" rel="noopener">src/nodes/display/PassNode.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>